<template>
    <div v-loading="load">
        <el-row>
            <tableComponents :isShow="false"
                :isHaveAdd="false"
                :isHaveExport="false"
                :isHavePagination="false">
                <template v-slot:table>
                    <el-row>
                        <div class="pd_20 plug_box">
                            <div class="cx_con_box pd_20"
                                v-for="(item, index) in itemList"
                                :key="index">
                                <div class="pd_20 cx_mid_ejlm box_plu">
                                    <el-col :span="11"
                                        class="f_l"
                                        style="position:relative">
                                        <img src="../../assets/img/iph6.png"
                                            alt />
                                        <img :src="$fnc.getImgUrl(item.pic)"
                                            class="plufin_img"
                                            alt />
                                    </el-col>
                                    <el-col :span="11"
                                        class="f_r tl">
                                        <p class="cx_con_box_title">{{ item.title }}</p>
                                        <p class="cx_con_box_con">功能简介：{{ item.desc }}</p>
                                        <p class="cx_con_box_jiage"
                                            v-if="showStr.indexOf('价格') == -1">
                                            ￥{{ item.price | keepTwoNum }}
                                        </p>
                                        <div class="p-but plugin_btn">
                                            <el-button :loading="$store.state.isLoading"
                                                :type="
                          item.is_open == '1'
                            ? 'primary'
                            : 'success' && showStr.indexOf('购买按钮') == -1
                        "
                                                @click="isOpenPlug(item.is_open, item.title, item.url)"
                                                class="cx_con_box_an">{{
                          item.is_open == "1" ? "查看" : "立即开通"
                        }}</el-button>
                                            <el-button :loading="$store.state.isLoading"
                                                type="primary"
                                                v-if="showStr.indexOf('咨询客服') == -1"
                                                class="cx_con_box_an">咨询客服</el-button>
                                            <el-button :loading="$store.state.isLoading"
                                                type="primary"
                                                v-if="
                          item.video != 0 &&
                            item.video != '' &&
                            showStr.indexOf('视频') == -1
                        "
                                                class="cx_con_box_an"
                                                style="margin-left: 0;"
                                                @click="playVideo(item)">视频</el-button>
                                        </div>
                                    </el-col>
                                </div>
                            </div>
                        </div>
                    </el-row>
                </template>
            </tableComponents>
        </el-row>
        <el-dialog width="600"
            append-to-body
            custom-class="vide0-con"
            :visible.sync="showVideo"
            @close="close_video">
            <video id="video"
                autoplay="autoplay"
                :src="$fnc.getImgVideo(itemForm.video)"
                width="600"
                height="400"
                controls="controls">
                您的浏览器不支持视频播放
            </video>
        </el-dialog>
    </div>
</template>
<style>
.vide0-con {
    background-color: transparent;
    border: none;
    box-shadow: none;
    width: 600px;
}
.vide0-con .el-dialog__header {
    display: none;
}
.mt20 {
    margin-top: 20px;
}
.cx_top_title {
    height: 30px;
    line-height: 30px;
    font-size: 16px;
    margin-bottom: 10px;
}
.cx_top_con {
    background: #fff;
    padding: 20px 0;
}
.cx_top_con_col {
    height: 50px;
    line-height: 50px;
}
.cx_top_con_c {
    padding-left: 30px;
    font-size: 18px;
    font-weight: bold;
    color: #ff4673;
}
.cx_top_con_qian {
    font-size: 14px;
}
.cx_top_con_dw {
    font-weight: 100;
    color: #000;
    margin-left: 5px;
}
.cx_top_con_djzj {
    color: #33d4a0;
}
.cx_mid_title {
    height: 43px;
    display: inline-block;
    cursor: pointer;
    width: 140px;
    line-height: 43px;
    border-top: solid 2px #f2f2f2;
    color: #a1a1a1;
    background-color: #f2f2f2;
    margin-right: 10px;
    margin-bottom: 10px;
    text-align: center;
}
.cx_mid_titleu {
    background-color: #fff;
    border-top: solid 2px #38a9f9;
}
.cx_mid_title_tit {
    display: inline-block;
    width: 150px;
    cursor: pointer;
    border: solid 1px #e9e9e9;
    border-bottom: none;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    margin-left: 15px;
}
.cx_mid_title_titu {
    color: #fff;
    font-weight: bold;
    background-color: #38a9f9;
    border: solid 1px #38a9f9;
    border-bottom: none;
}
.cx_mid_ejlm {
    background: #fff;
}
.cx_mid_ejlm_title {
    border-bottom: solid 1px #e9e9e9;
    height: 41px;
    line-height: 41px;
}
.cx_con_box {
    margin: 0 0px 45px;
    padding: 20px;
}
.cx_con_box_title {
    height: 60px;
    line-height: 60px;
}
.cx_con_box_con {
    color: #adadad;
    font-size: 12px;
    line-height: 25px;
    height: 150px;
    overflow: hidden;
}
.cx_con_box_jiage {
    height: 40px;
    line-height: 40px;
    color: #ff4673;
}

.p-but {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
}
.p-but .el-button {
    margin-bottom: 10px;
    width: 45%;
}
.cx_con_box_an {
    /* flex: 1; */
    height: 30px;
    line-height: 30px;
    padding: 0;
    font-size: 14px;
}
.cxSwith {
    height: 25px !important;
    line-height: 25px !important;
    display: inline-block;
}
.box_plu {
    background: #fff;
    border: solid 1px #e9e9e9;
    border-radius: 20px;
    box-shadow: 0px 0px 15px #dedede;
    overflow: hidden;
}
.cxSwith > .el-switch__core {
    height: 25px !important;
    border-radius: 16px !important;
    border: 1px solid #dfdfdf !important;
}
.cxSwith > .el-switch__core:after {
    width: 20px !important;
    height: 20px !important;
    top: 2px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.cxSwith.el-switch.is-checked .el-switch__core::after {
    margin-left: -21px !important;
}
.cxSwith > .el-switch__label {
    text-indent: 5px;
}
.plufin_img {
    position: absolute;
    top: 45px;
    left: 15px;
    width: 140px;
    height: 256px;
}
.cx_mid_title_tit > span {
    display: block;
    width: 100%;
    height: 100%;
}
.plug_box {
    display: flex;
    justify-content: flex-start;
    flex-wrap: wrap;
    align-items: center;
    min-width: 1300px;
}
.plug_box > div {
    width: 450px;
}
</style>
<script>
import HeadTitle from "@/components/currency/HeadTitle.vue";
export default {
    components: {
        HeadTitle
    },
    data () {
        return {
            showStr: "",
            load: false,
            itemList: [],
            menuList: this.$store.state.menuList,
            itemForm: {
                video: "",
                title: ""
            },
            showVideo: false
        };
    },
    methods: {
        getsetting () {
            this.$api.getSettings.findConfig({ iden: "module_market " }).then(res => {
                if (res.data.code == 200) {
                    this.showStr = res.data.result || "";
                }
            });
        },
        close_video () {
            document.getElementById("video").pause();
            // this.showVideo = false;
        },
        playVideo (item) {
            this.itemForm = item;
            this.showVideo = true;
        },
        getcateList () {
            this.load = true;
            var param = {};
            param.cate = "";
            this.$api.getAdmin.getAdmincateList(param).then(res => {
                if (res.data.code == 200) {
                    this.itemList = res.data.result;
                }
                this.load = false;
            });
        },
        isOpenPlug (i, str, url) {
            if (i == "0") {
                // this.dioForm=true;
            } else {
                var obj = this.menuList;
                this.$fnc.tomenu(url, obj);
            }
        }
    },
    mounted () {
        this.getcateList();
        this.getsetting();
    },
    computed: {
        getMenu () {
            return this.$store.state.menuList;
        }
    },
    watch: {
        getMenu (obj) {
            this.menuList = obj;
        }
    }
};
</script>
